<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <meta charset="UTF-8"/>
    <title>Insert title here</title>
</head>
<body>
<h1 th:inlines="text">文件上传</h1>
<form action="/fileUpload" method="post" enctype="multipart/form-data">
    <p>选择文件: <input type="file" name="fileName"/><br>
    <p><input type="submit" value="提交"/></p>
</form>
<!--<input type="file" name="fileName" id="fileName"><br>-->
<!--<input type="text" name="filename" id="content">请填写文件名<br>-->
<!--<input type="button" id="submit" value="提交"><br>-->


</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<script>
    /*
    $(document).ready(function () {
        console.log("进入到jquery")
        $('#submit').click(function () {

            console.log("进入到submit")
            $.ajax({
                contentType: false,
                process : false,
                url: "/fileUpload",
                type: "GET",
                data: {
                    file: $('#fileName'),
                    filename: $('#content').val(),
                },
                success: function () {
                    console.log("上传成功!")
                }
            })
        });
    })
     */
</script>
</html>


<!--多文件上传-->
<!--<!DOCTYPE html>-->
<!--<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"-->
<!--      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">-->
<!--<head>-->
<!--    <meta charset="UTF-8" />-->
<!--    <title>Insert title here</title>-->
<!--</head>-->
<!--<body>-->
<!--<h1 th:inlines="text">文件上传</h1>-->
<!--<form action="multifileUpload" method="post" enctype="multipart/form-data" >-->
<!--    <p>选择文件1: <input type="file" name="fileName"/></p>-->
<!--    <p>选择文件2: <input type="file" name="fileName"/></p>-->
<!--    <p>选择文件3: <input type="file" name="fileName"/></p>-->
<!--    <p><input type="submit" value="提交"/></p>-->
<!--</form>-->
<!--</body>-->
<!--</html>-->